//
//  AboutViewController.swift
//  ReadHub
//
//  Created by testypp on 2018/1/9.
//  Copyright © 2018年 longyiqun. All rights reserved.
//

import Foundation
import UIKit
import Eureka

class AboutViewController: FormViewController {
	
	// 开始
	override func viewDidLoad() {
		super.viewDidLoad()
		
		self.setupUI()
		
	}
	
	func setupUI() -> () {
		
		let statusView = UIView(frame: CGRect(x: 0, y: 0, width: self.view.bounds.width, height: 72))
		
		statusView.backgroundColor = Constants.mainBackGroundColor
		
		let backBtn = UIButton(frame: CGRect(x: 10, y: 32, width: 32, height: 32))
		backBtn.backgroundColor = UIColor.clear
		backBtn.setImage(#imageLiteral(resourceName: "backBtn"), for: .normal)
		
		let backBtnTapped: UITapGestureRecognizer = UITapGestureRecognizer.init(target: self, action: #selector(AboutViewController.backBtnTapped(sender:)))
		backBtnTapped.numberOfTapsRequired = 1
		backBtn.addGestureRecognizer(backBtnTapped)
		
		
		statusView.addSubview(backBtn)
		
		
		self.view.addSubview(statusView)
		
		let tableViewFrame = CGRect(x: 0, y: 72, width: self.view.bounds.width, height: self.view.bounds.height - 72)
		self.tableView.frame = tableViewFrame
		
		form +++
			
			// 高度为0的header
			Section() { section in
				var header = HeaderFooterView(title: "")
				header?.onSetupView = { view,  _ in
				}
				header?.height = { 0.000001 }
				section.header = header
			}
			
			<<< LabelRow(){ row in
				row.title = "版本号"
				row.value = "2.0"
			}
			<<< LabelRow(){ row in
				row.title = "网站"
				row.value = "ReadHub.me"
			}
			<<< LabelRow(){ row in
				row.title = "作者"
				row.value = "龙轶群"
			}
	}
	
	
	@objc func backBtnTapped(sender: UITapGestureRecognizer) {
		self.dismiss(animated: true, completion: {});
	}
	
	
}
